
********************************************************************************

*-------------------------------------------------------------------------------
*-------------------------------------------------------------------------------
*
*	Title:		"Hurting or Healing? How War Experiences and Traumatization 
* 				(Do Not) Shape Support for Truth Commissions"
*
*	Authors: 	Amélie Godefroidt & Karin Dyrstad
*	Journal: 	Conflict Management and Peace Science
*
*-------------------------------------------------------------------------------
*-------------------------------------------------------------------------------

********************************************************************************



********************************************************************************
**# Contents

* Part I: DATA CLEANING
*   1) Creating the variables
*   2) Generating the dataset
* PART II: DESCRIPTIVE STATISTICS (Table 1, Appendix C, Appendix D)
*    Table 1 (article)
*    Table C.1	Descriptive Statistics for Key Socio-Demographic Variables, by Case Study.
*    Table D.1	Full List of Conflict Experiences and Incidence Rate,  by Case Study.
*    Table D.2	Correlations of Specific Conflict Experiences with Traumatization, by Case Study.
*    Table D.6	Bivariate Correlations Between Variables of Interest, by Case Study.
* PART III: DATA ANALYSES (Figures 2-3, Appendix D)
*    1) Identifying best model fit (Table D.3	Model Comparison)
*    2) Fitting the best model (Figures 2-3; Table D.4	Full Numerical Results)
*   3) 3) Maps of spatial distribution of samples  
* PART IV (Appendix B)
*    1) Maps of spatial distribution of samples
*    Figure B.1	Spatial Distribution of Guatemalan Sample, by Municipality.
*    Figure B.2	Spatial Distribution of Nepali Sample, by District.




********************************************************************************
** What the variables measure: 
/*
tc_1: It is important to know what happened and collect testimonies
tc_2: A TC should reveal the names
tc_3: Victims should receive compensation
tc_4: TC meaningless unless accompanied by prosecution
ptsd_1 - _5: Short screener for PTSD
*/
********************************************************************************

********************************************************************************



clear all

cd "\GodefroidtDyrstad_2024_ReplicationFiles"

log using hh_log, replace text

use hh_replicationdata.dta





********************************************************************************

**# PART I: DATA CLEANING

********************************************************************************
/* 
PART I is included for information only;
the code will not run properly since the data has 
already been cleaned 

************************************************
*** 1) Creating the variables
************************************************

**** Dependent variables: Support for Truth Commissions
* Reversal 
foreach var of varlist q526_*  {
g i`var' = 6-`var'
}

* Renaming and labelling
gen tc_1 = iq526_2
lab var tc_1 "It is important to know what happened and collect testimonies"
gen tc_2 = iq526_3
lab var tc_2 "A TC should reveal the names"
gen tc_3 = iq526_5
lab var tc_3 "Victims should receive compensation"
gen tc_4 = iq526_6
lab var tc_4 "TC meaningless unless accompanied by prosecution"


**** Main Independent Variable: Exposure
* Dummy variables
foreach var of varlist q404_* q404g_1 {
recode `var' (1=1)(2=0)(else=.), gen(d`var')
}

* Combining into one measure
egen exposure = anymatch(dq*), values(1) 
lab var exposure "Victim during conflict"


* Direct victimization
egen victim_d = anymatch(dq404_1 dq404_2 dq404_3 dq404_4 dq404_5 dq404_6 dq404_7 dq404_8 dq404_9), values(1) 

* Indirect victimization
egen victim_i = anymatch(dq404_10 dq404_11 dq404_12 dq404_13 dq404_14 dq404_15 dq404g_1), values(1) 

* Categorization of direct/indirect victimization
egen victim_groups = group(victim_d victim_i)
lab val victim_groups groups
lab define groups 1 "None" 2 "Indirect only" 3 "Direct only" 4 "Both", modify



**** Mediator: PTSD
* Renaming
g ptsd_1 = q411_1
g ptsd_2 = q411_2
g ptsd_3 = q411_4
g ptsd_4 = q411_5
g ptsd_5 = q411_6
lab var ptsd_1 "Disturbing memories of a stressful experience"
lab var ptsd_2 "Upset when something reminded you of a stressful experience"
lab var ptsd_3 "Distant or cut off from other people"
lab var ptsd_4 "Irritable or having angry outbursts"
lab var ptsd_5 "Difficulty concentrating"

* Summated rating scale for descriptive statistics
g ptsd_scale = (ptsd_1 + ptsd_2 +ptsd_3 + ptsd_4 + ptsd_5)/5
lab var ptsd_scale "PTSD scale"

* Dummy variable for robustness checks
recode ptsd_scale (1=0)(nonmiss=1), gen(ptsd_d)
lab var ptsd_d "Any symptom of PTSD"


**** Control variables
* Didn't reside in country during conflict
recode q401 (1=0) (else=1), gen(nonreside)

* Age
g age = q101
lab var age "Age"

* Income
g income = 5-q610
lab var income "Income"



************************************************
*** 2) Generating dataset
************************************************
**** Listwise deletion
quietly regress tc_* ptsd_* exposure male age educ income nonreside
g sample = e(sample)
lab var sample "Valid observations across all models" 
drop if sample==0

**** Removing redundant variables
keep country tc_* exposure q404_* q404g_1 ptsd* dq* male age educ income nonreside
save hh_replication.dta, replace

*/


********************************************************************************

**# PART II: DESCRIPTIVE STATISTICS

********************************************************************************

**** Table 2. Descriptive Statistics of Main Variables, by Case Study
tabstat exposure ptsd_scale tc_1 tc_2 tc_3 tc_4, by(country) stats(mean sd) format(%9.2f)

anova exposure i.country 
pwcompare country, mcompare(tukey) pveffects
tab exposure country, chi
anova ptsd_scale i.country 
pwcompare country, mcompare(tukey) pveffects
anova tc_1 i.country 
pwcompare country, mcompare(tukey) pveffects
anova tc_2 i.country
pwcompare country, mcompare(tukey) pveffects
anova tc_3 i.country
pwcompare country, mcompare(tukey) pveffects
anova tc_4 i.country
pwcompare country, mcompare(tukey) pveffects


**** Table C.1	Descriptive Statistics for Key Socio-Demographic Variables, by Case Study (Appendix).
bysort country: sum male age educ income nonreside


**** Table D.1	Full List of Conflict Experiences and Incidence Rate,  by Case Study (Appendix).
tabstat  dq404_* dq404g_1, by(country) stat(mean) format(%5.2f)

tab dq404_1 country, chi
tab dq404_2 country, chi
tab dq404_3 country, chi
tab dq404_4 country, chi
tab dq404_5 country, chi
tab dq404_6 country, chi
tab dq404_7 country, chi
tab dq404_8 country, chi
tab dq404_9 country, chi
tab dq404_10 country, chi
tab dq404_11 country, chi
tab dq404_12 country, chi
tab dq404_13 country, chi
tab dq404_14 country, chi
tab dq404_15 country, chi

anova dq404_1 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_2 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_3 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_4 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_5 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_6 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_7 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_8 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_9 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_10 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_11 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_12 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_13 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_14 i.country
pwcompare country, mcompare(tukey) pveffects
anova dq404_15 i.country


**** Table D.2	Correlations of Specific Conflict Experiences with Traumatization, by Case Study (Appendix).
bysort country: pwcorr ptsd_scale exposure dq404_* dq404g_1, sig



**** Table D.6	Bivariate Correlations Between Variables of Interest, by Case Study (Appendix).
bysort country: pwcorr tc_1 tc_2 tc_3 tc_4 exposure ptsd_scale , sig







********************************************************************************

**# PART III: DATA ANALYSES

********************************************************************************


************************************************
*** 1) Identifying best model fit 
************************************************
*  testing different combinations of constraints; 
*  using primary DV only (tc_1: general support)
*  reported in Table D.3 Model Comparison (Appendix). 
************************************************

* M0: No constaints
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* determinants of DV1 */
	group(country)  stand 
estat gof, stat(all)
estat ginvariant
est store m0


* M1:  Constraining the measurement part of the model - intercept only --> best model fit
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1 */
	group(country)  stand ginvariant(mcons)
estat gof, stat(all)
estat mindices
est store m1

* M2: Constraining the measurement part of the model - coefficient only
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1 */
	group(country)  stand ginvariant(mcoef)
estat gof, stat(all)
est store m2

* M3: Constraining the measurement part of the model - both
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1 */
	group(country)  stand ginvariant(mcoef mcons )
estat gof, stat(all)
est store m3

* M4: Constraining both measurement and structural parts of the model - intercept
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1 */
	group(country)  stand ginvariant(mcoef mcons scons)
estat gof, stat(all)
est store m4

* M5: Constraining both measurement and structural parts of the model - coefficient
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1 */
	group(country)  stand  ginvariant(mcoef mcons scoef)
estat gof, stat(all)
est store m5


* M6: Constraining both measurement and structural parts of the model - both
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1 */
	group(country)  stand ginvariant(mcoef mcons scoef scons) 
estat gof, stat(all)
est store m6


**** M1_1: Based on Mindices of M1: adding covariance between two ptsd error terms
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1 */
	group(country)  stand ginvariant(mcons) covariance(1:e.ptsd_1*e.ptsd_2) ///
	covariance(2:e.ptsd_1*e.ptsd_2) covariance(3:e.ptsd_1*e.ptsd_2)
est store m1_1
estat gof, stat(all)
lrtest m1 m1_1



************************************************
*** 2) Fitting the best model (Appendix D)
************************************************
/* Using all four DVs; 
 creates Figures 2-3; Table D.4	Full Numerical Results */
************************************************


* tc_1: General support for TCs
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure male age educ income nonreside) , /// /* DV1   */
	group(country)	stand 	ginvariant(mcons) 	///
	 covariance(1:e.ptsd_1*e.ptsd_2) covariance(2:e.ptsd_1*e.ptsd_2) covariance(3:e.ptsd_1*e.ptsd_2)
est store tc1
predict tc1, xb(tc_1) /* predicted values for TC_2 */
predict ptsd, xblat  /* predicted values for latent variable PTSD */



* tc_2: A TC should reveal the names of the perpetrators
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_2 <- PTSD exposure male age educ income nonreside) , /// /* DV2   */
	group(country)	stand 	ginvariant(mcons) ///
	covariance(1:e.ptsd_1*e.ptsd_2) covariance(2:e.ptsd_1*e.ptsd_2) covariance(3:e.ptsd_1*e.ptsd_2)
est sto tc2
predict tc2, xb(tc_2) /* predicted values for TC_2 */


* tc_3: Victims should receive compensation
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_3 <- PTSD exposure male age educ income nonreside) , /// /* DV3   */
	group(country)	stand 	ginvariant(mcons) ///
	covariance(1:e.ptsd_1*e.ptsd_2) covariance(2:e.ptsd_1*e.ptsd_2) covariance(3:e.ptsd_1*e.ptsd_2)
est sto tc3
predict tc3, xb(tc_3) /* predicted values for TC_3 */


* tc_4: TC meaningless unless accompanied by prosecution
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure male age educ income nonreside ) /// /* determinants of PTSD */ 
	(tc_4 <- PTSD exposure male age educ income nonreside) , /// /* DV4   */
	group(country)	stand 	ginvariant(mcons) 	///
	covariance(1:e.ptsd_1*e.ptsd_2) covariance(2:e.ptsd_1*e.ptsd_2) covariance(3:e.ptsd_1*e.ptsd_2)
est sto tc4
predict tc4, xb(tc_4) /* predicted values for TC_4 */


est tab tc1 tc2 tc3 tc4, stats(b_std)  star b(%12.3f)



**** Table D.5	Replication of Main Results, Excluding Control Variables (Appendix).
sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure ) /// /* determinants of PTSD */ 
	(tc_1 <- PTSD exposure ) , /// /* DV1 */
	group(country)  stand  ginvariant(mcons) ///
	covariance(1:e.ptsd_1*e.ptsd_2) covariance(2:e.ptsd_1*e.ptsd_2) covariance(3:e.ptsd_1*e.ptsd_2)

sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure   ) /// /* determinants of PTSD */ 
	(tc_2 <- PTSD exposure ) , /// /* DV2 */
	group(country)  stand  ginvariant(mcons) ///
	covariance(1:e.ptsd_1*e.ptsd_2) covariance(2:e.ptsd_1*e.ptsd_2) covariance(3:e.ptsd_1*e.ptsd_2)

sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure   ) /// /* determinants of PTSD */ 
	(tc_3 <- PTSD exposure ) , /// /* DV3 */
	group(country)  stand  ginvariant(mcons)

sem (PTSD -> ptsd_1 ptsd_2 ptsd_3 ptsd_4 ptsd_5) /// /* measuring PTSD */
	(PTSD <- exposure   ) /// /* determiants of PTSD */ 
	(tc_4 <- PTSD exposure ) , /// /* DV4 */
	group(country)  stand  ginvariant(mcons)


	

********************************************************************************

**# PART IV: SPATIAL DISTRIBUTION OF SAMPLES

********************************************************************************
/* Creates FIGURES B.1-B.2 (Appendix) */
************************************************


clear all

/*
** Create shapefile
// Obtained from http://www.diva-gis.org/gdata
shp2dta using GTM_adm2, database(guadm2) coordinates(guacoord2) genid(id) gencentroids(cc)  replace

** Add survey id
use guadm2, clear
merge 1:1 id using guate_idkey
drop mapname _merge
save, replace

** Generate sample size by municipality
preserve
use "ANONYMOUS.dta", clear
collapse (count) cg2 , by(cg3)
rename cg2 samplesize
rename cg3 papid
drop if papid ==.
save guatemap.dta, replace
restore
merge m:1 papid using guatemap
save, replace
*/

**** Figure B.1 Map of spatial distribution of sampling, Guatemala (Appendix)
use guadm2, clear
spmap samplesize using guacoord2, id(id) clm(c) clbreak(1 13 42 133)  fcolor(Blues) legstyle(2) ocolor(Greys) legend(cols(1) pos(5) size(small)) ///
	legtitle(Sample size) leglabel("test" "test2") ///
	ndfcolor(gs10) ndocolor(gs8) ndsize(vthin) ndlabel("Not sampled") ///
	label(data(guatecapital)  xcoord(x_cc) ycoord(y_cc) select(keep if capital==1) lab(capital)  size(small) pos(4) gap(*.02) ) 

	
/*
** Create shapefile
shp2dta using NPL_adm3, database(nepadm3) coordinates(nepcoord3) genid(nid) gencentroids(cc)  replace

** Add survey id
use nepadm3, clear
merge 1:1 nid using nepal_idkey
drop _merge
save, replace

** Generate sample size by municipality
use "ANONYMOUS.dta", clear
collapse (count) country , by(cn1)
rename cn1 papid
rename country samplesize
drop if papid ==.
save nepalmap.dta, replace
restore
merge m:1 papid using nepalmap
save, replace
*/

**** B.2 Map of spatial distribution of sampling, Nepal (Appendix)
use nepadm3, clear
spmap samplesize using nepcoord3, id(nid) clm(c) clbreak(19 39 59 99 101)  fcolor(Blues) legstyle(2) ocolor(Greys) legend(cols(1) pos(7) size(small)) ///
	legtitle(Sample size) ///
	ndfcolor(gs10) ndocolor(gs8) ndsize(vthin) ndlabel("Not sampled") ///
	label(data(nepalcapital)  xcoord(x_cc) ycoord(y_cc) select(keep if capital==1) lab(capital)  size(small) pos(4) gap(*.02) ) 

	


 log close
